#pragma once
#include"Protocol.hpp"
#include<iostream>

class Cal
{
public:
    Cal()
    {}
    Response Execute(Request& req)
    {

        Response resp;
        switch(req.OPER())
        {
            case '+':
            resp.SetResault(req.X()+req.Y());
            break;
            case '-':
            resp.SetResault(req.X()-req.Y());
            break;
            case '*':
            resp.SetResault(req.X()*req.Y());
            break;
            case '/':
            if(req.X()==0)
            {
                resp.SetCode(1);
            }
            else{ resp.SetResault(req.X()/req.Y());}
            break;
            case '%':
            if(req.Y()==0)
            {
                resp.SetCode(2);
            }
            else{ resp.SetResault(req.X()%req.Y());}
            break;
            default:
            resp.SetCode(3);
            break;
        }
        return resp;
    }
private:
};